package cn.wolfcode.web.controller;

import cn.wolfcode.common.exception.BusinessException;
import cn.wolfcode.common.web.CommonCodeMsg;
import cn.wolfcode.common.web.Result;
import cn.wolfcode.domain.AccountLog;
import cn.wolfcode.domain.OperateIntergralVo;
import cn.wolfcode.domain.UsableIntegral;
import cn.wolfcode.service.IUsableIntegralService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;


@RestController
@RequestMapping("/intergral")
public class IntegralController {
    @Autowired
    private IUsableIntegralService usableIntegralService;


    @RequestMapping("/payOnIntergral")
    public Result<String>  payOnIntergral(@RequestBody OperateIntergralVo vo){
        usableIntegralService.descIntergralTry(vo,null);
        return Result.success("");
    }

    @RequestMapping("/refundOnIntergral")
    Result<String> refundOnIntergral(@RequestBody OperateIntergralVo vo){

        // 增加用户积分
        usableIntegralService.incrIntergralTry(vo,null);
        return Result.success("");
    }
}
